{extend name="layout:default" /}

{block name="title"}考勤管理{/block}

{block name="content"}
<link href="https://cdn.bootcss.com/layer/2.2/skin/layer.css" rel="stylesheet">
<div class="row">

    <div class="col-xs-12">

        <div class="box">

            <div class="box-header">

                <h3 class="box-title">考勤列表</h3>

                <div class="box-tools">

                </div>

            </div>

            <form class="form-inline clearfix" method="get">
                <div class="row pull-right" style="margin: 10px 10px 20px;">
                    <div class="form-group">
                        <label for="reservation">签到时间：</label>
                        <input type="text" name="time" class="form-control" value="{$Request.param.start}" id="reservation" placeholder="开始时间">
                    </div>
                    <div class="form-group">
                        <input type="text" class="form-control" name="kw" value="{$Request.param.kw}" placeholder="请输入手机号\用户名\姓名">
                    </div>
                    <input type="submit" class="btn btn-primary" value="查询">
                </div>
            </form>
            <!-- /.box-header -->

            <div class="box-body table-responsive no-padding">

                <table class="table table-hover">
                    <tbody>
                    <tr>
                        <th>序号</th>
                        <th>姓名</th>
                        <th>手机号</th>
                        <th>正常出勤天数</th>
                        <th>迟到天数</th>
                        <th>所属班级</th>
                        <th>最后一次签到时间</th>
                        <th>操作</th>
                    </tr>

                    {volist name="cadre" id="vo"}
                    <tr>
                        <td>{$vo.id}</td>
                        <td>{$vo.name}</td>
                        <td>{$vo.mobile}</td>
                        <td>{$vo.normal}</td>
                        <td>{$vo.late}</td>
                        <td>{$vo.cls.name}</td>
                        <td>{:date('Y-m-d H:i:s',$vo.last_time)}</td>
                        <td>
                            <a href="{:url('/admin/attendance/detail', ['id'=>$vo.id])}" title="查看详情" class="btn btn-primary">查看详情</a>
                        </td>
                    </tr>
                    {/volist}
                    </tbody>

                </table>
                {$cadre->render()}
            </div>
            <!-- /.box-body -->
        </div>
        <!-- /.box -->
    </div>
</div>

{/block}

{block name="js"}

<script src="https://cdn.bootcss.com/layer/2.2/layer.js"></script>
<script>

    function status(obj, id) {
        let s = +($(obj).prop("checked"));
        /*if (s == 2) {
            $('input:checkbox').prop('checked', false);
            $(obj).prop('checked', true);
        }*/
        // console.log(s, id);
        layer.confirm('您确定要改变？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            $.post('/admin/evaluations/status', {id:id, status: s}, function (data) {
                if (data.status == 200) {
                    layer.msg(data.message, {icon: 1})
                } else {
                    layer.msg(data.message, {icon: 2})
                }
                setTimeout(function () {
                    window.location.href = window.location;
                }, 200)
            });
        }, function(){
        });
    }
    $('#reservation').datepicker({
        autoclose: true
    });
</script>
{/block}